home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / src / tutorials / custEducation / opengl2 / lib / key.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-08-02  |  1.9 KB  |  74 lines

  1. /*
  2.  * Copyright 1993, 1994, Silicon Graphics, Inc.
  3.  * All Rights Reserved.
  4.  *
  5.  * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
  6.  * the contents of this file may not be disclosed to third parties, copied or
  7.  * duplicated in any form, in whole or in part, without the prior written
  8.  * permission of Silicon Graphics, Inc.
  9.  *
  10.  * RESTRICTED RIGHTS LEGEND:
  11.  * Use, duplication or disclosure by the Government is subject to restrictions
  12.  * as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
  13.  * and Computer Software clause at DFARS 252.227-7013, and/or in similar or
  14.  * successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
  15.  * rights reserved under the Copyright Laws of the United States.
  16.  */
  17.  
  18.  
  19. #include <aux.h>
  20. #include <auxPrivate.h>
  21.  
  22. /**************************************************************************
  23.  *   auxKeyFunc() - set key callback functions
  24.  **************************************************************************/
  25.  
  26. GLvoid
  27. auxKeyFunc( GLint key, GLvoid (*_keyFunc)( GLvoid ) )
  28. {
  29.     KeyFunc             *tmp;
  30.     KeyFunc             *new;
  31.  
  32.     new = (KeyFunc *) malloc( sizeof( KeyFunc ) );
  33.  
  34.     new->key = key;
  35.     new->keyFunc = _keyFunc;
  36.     new->left = (KeyFunc *) NULL;
  37.     new->right = (KeyFunc *) NULL;
  38.  
  39.     if ( !keyHead )
  40.         keyHead = new;
  41.     else {
  42.         tmp = keyHead;
  43.         while ( tmp ) 
  44.             if ( key < tmp->key )
  45.                 if ( !tmp->right ) {
  46.                     tmp->right = new;
  47.                     break;
  48.                 } else
  49.                     tmp = tmp->right;
  50.             else
  51.                 if ( !tmp->left ) {
  52.                     tmp->left = new;
  53.                     break;
  54.                 } else
  55.                     tmp = tmp->left;
  56.     }
  57. }
  58.  
  59.  
  60. /**************************************************************************
  61.  *   auxDeleteKeyFunc() - set key callback functions
  62.  **************************************************************************/
  63.  
  64. GLvoid
  65. auxDeleteKeyFunc( GLint key, GLvoid (*_keyFunc)( GLvoid ) )
  66. {
  67.     KeyFunc           *tmp;
  68.  
  69.     if ( !keyHead )
  70.         return;
  71.  
  72.     /*  COMPLETE BINARY TREE NODE REMOVAL OPERATION  */
  73. }
  74.